package com.flute.framework.util.ftp;

import com.flute.framework.search.ProviderInfo;


public class FileFactory {

	public static IFileOperation getFileOperation(
			ProviderInfo info) {
		String type = info != null ? info.getType() : null;
		try {
			if (LocalFile.DEFAULT_PROTOCOL.equals(type)) {
				return LocalFile.parse(info);
			} else if (FtpFile.DEFAULT_PROTOCOL.equals(type)) {
				return FtpFile.parse(info);
			} else {
				return LocalFile.parse(info);
			}
		} catch (Exception e) {
			return null;
		}
	}
}
